unit con_Carga;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Formulario_Padrao_Consulta, Grids, DBGrids, Db, DBTables, StdCtrls,
  Buttons, ExtCtrls, TFlatButtonUnit;

type
  TfrmCon_Carga = class(TFrmConsulta)
    Query1: TQuery;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    edValor: TEdit;
    Query1CAR_NUMERO: TStringField;
    Query1CAR_PESO: TFloatField;
    Query1TRAN_NOME: TStringField;
    procedure FormActivate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BtnFecharClick(Sender: TObject);
    procedure edValorChange(Sender: TObject);
    procedure DBGrid1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  frmCon_Carga: TfrmCon_Carga;
  xcarga: string;
implementation

uses Biblio;

{$R *.DFM}

procedure TfrmCon_Carga.FormActivate(Sender: TObject);
begin
  inherited;
  Query1.open;
end;

procedure TfrmCon_Carga.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  query1.close;
end;

procedure TfrmCon_Carga.BtnFecharClick(Sender: TObject);
begin
  inherited;
  xcarga := Query1CAR_NUMERO.Value;
end;

procedure TfrmCon_Carga.edValorChange(Sender: TObject);
begin
  inherited;
  Query1.Locate('CAR_NUMERO', StrZero(edValor.Text, 6), [lopartialkey]);
end;

procedure TfrmCon_Carga.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  inherited;
  if key = 12 then BtnFechar.SetFocus;
end;

end.
